# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=lua-stdlib-normalize
_rockname=std.normalize
pkgver=2.0.2
pkgrel=0
pkgdesc="Normalized Lua functions"
url="https://lua-stdlib.github.io/normalize/"
arch="noarch"
license="MIT"
depends="lua lua-stdlib-debug"
provides=""
options="!check"  # FIXME: requires lua-specl that we don't have yet
source="$pkgname-$pkgver.tar.gz::https://github.com/lua-stdlib/normalize/archive/v$pkgver.tar.gz"
builddir="$srcdir/normalize-$pkgver"

_luaversions="5.1 5.2 5.3"
for _v in $_luaversions; do
	provides="$provides lua$_v-${pkgname#lua-}=$pkgver-r$pkgrel"  # for backward compatibility
done

package() {
	local lmod_dir="$pkgdir/usr/share/lua/common"
	local rockdir="$pkgdir/usr/lib/luarocks/rocks-common/$_rockname/$pkgver-1"

	mkdir -p "$lmod_dir"
	cp -r "$builddir"/lib/std "$lmod_dir"/

	mkdir -p "$rockdir"
	echo 'rock_manifest = {}' > "$rockdir"/rock_manifest
}

sha512sums="bde7d834ce5324ee6af7e3f76d138f75bb6c55612e6e524a06d7886b92b346043a2ad4befec5f68342d369e7ed610f00388243b18886a53de6cce123b6a7637f  lua-stdlib-normalize-2.0.2.tar.gz"
